package dnl.dtools.grm.ssh;

import java.io.IOException;

import org.apache.commons.vfs.FileObject;
import org.apache.commons.vfs.FileSystemManager;
import org.apache.commons.vfs.VFS;

public class PG {

	public static void main(String[] args) throws IOException, Exception {
//		System.setProperty("java.protocol.handler.pkgs", "dnl.dtools.grm");
//		DOMConfigurator.configure("log4j.xml");
//		PasswordManager passwordManager = new PasswordManager();
//		SshSessionManager sessMan = new SshSessionManager();
//		SshSessionInfo sessInfo = sessMan.getRegisteredSession("152.62.67.90");
//		SshSession sess = new SshSession(sessInfo);
//		sess.setPasswordManager(passwordManager);
//		sess.connect();
//		
//		OutputListener sysoutListener = new OutputListener(){
//			public void newOutputLine(String line) {
//				System.out.println(line);
//			}
//		};
//		OutputListener syserrListener = new OutputListener(){
//			public void newOutputLine(String line) {
//				System.err.println(line);
//			}
//		};
//		
//		OngoingSshCommandResult r = sess
//				.executeOngoingCommand(
//						"tail -f /home/nlayers/Seneca/management/server/default/log/server.log",
//						sysoutListener, syserrListener);
//		System.out.println(r);
		
		FileSystemManager fsManager = VFS.getManager();
		FileObject jarFile = fsManager.resolveFile( "ftp://daniel:hereiam@localhost/home/daniel" );
		System.err.println(jarFile.getFileSystem().getRootName());

		// List the children of the Jar file
//		FileObject[] children = jarFile.getChildren();
//		System.out.println( "Children of " + jarFile.getName().getURI() );
//		for ( int i = 0; i < children.length; i++ )
//		{
//		    System.out.println( children[ i ].getName().getBaseName() );
//		}
		
//		URL url = new URL("ssh://daniel@10.1.1.22/~/tmp");
//		GanymedSshEntry ent = new GanymedSshEntry(url, sess);
//		ent.list();
//		System.err.println(">> "+url.getHost());
//		System.err.println(">> "+url.getUserInfo());
//		System.err.println(">> "+url.getPath());
//		System.err.println(">> "+url.getFile());
	}

}
